import request from '@/utils/request'

// 查询知识课程列表
export function listCourse(query) {
  return request({
    url: '/yjnb/course/list',
    method: 'get',
    params: query
  })
}

// 查询知识课程详细
export function getCourse(id) {
  return request({
    url: '/yjnb/course/' + id,
    method: 'get'
  })
}

// 新增知识课程
export function addCourse(data) {
  return request({
    url: '/yjnb/course',
    method: 'post',
    data: data
  })
}

// 修改知识课程
export function updateCourse(data) {
  return request({
    url: '/yjnb/course',
    method: 'put',
    data: data
  })
}

// 删除知识课程
export function delCourse(id) {
  return request({
    url: '/yjnb/course/' + id,
    method: 'delete'
  })
}
  export function publishKnowledgeCourse(data) {
    return request({
      url:"/yjnb/course/publishKnowledgeCourse", 
      method: "post",
      data: data,
      withLoading: true,
    });
  }
  // 取消发布农科讲堂课程
  export function unPublishKnowledgeCourse(data) {
    return request({
      url:"/yjnb/course/unPublishKnowledgeCourse", 
      method: "post",
      data: data,
      withLoading: true,
    });
  }
  // 推荐农科讲堂课程
  export function recommendKnowledgeCourse(data) {
    return request({
      url:"/yjnb/course/recommendKnowledgeCourse", 
      method: "post",
      data: data,
      withLoading: true,
    });
  }
  // 取消推荐农科讲堂课程
  export function unRecommendKnowledgeCourse(data) {

    return request({
      url:'/yjnb/course/unRecommendKnowledgeCourse', 
      method: 'post',
      data: data,
      withLoading: true,
    });
}
